var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function c() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((c.prototype = i.prototype), new c()));
      };
    })(),
  ChatLineView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.textfield = null),
        (t.textfield = new Laya.HTMLDivElement()),
        t.addChild(t.textfield),
        t.textfield.on(Laya.Event.CLICK, t, t.onClickFn),
        (t.textfield.name = "ChatLineView"),
        t
      );
    }
    return (
      __extends(t, e),
      (t.prototype.onClickFn = function (e) {}),
      (t.prototype.dealHtmlEscapeStr = function (e) {
        var t = "";
        return void 0 == e
          ? ""
          : ((t = e.replace(/&/g, "&amp;")),
            (t = t.replace(/</g, "&lt;")),
            (t = t.replace(/>/g, "&gt;")),
            (t = t.replace(/ /g, "&nbsp;")),
            (t = t.replace(/'/g, "&#39;")),
            (t = t.replace(/"/g, "&quot;")));
      }),
      (t.prototype.dealHtmlDecodeRegExpStr = function (e) {
        var t = "";
        return void 0 == e && 0 == e.length
          ? ""
          : ((t = e.replace(/&amp;/g, "&")),
            (t = t.replace(/&lt;/g, "<")),
            (t = t.replace(/&gt;/g, ">")),
            (t = t.replace(/&nbsp;/g, " ")),
            (t = t.replace(/&#39;/g, "'")),
            (t = t.replace(/&quot;/g, '"')));
      }),
      (t.prototype.otherChatLineMessage = function (e) {
        var t;
        (e.c = this.dealHtmlEscapeStr(e.c)), (e.c = this.getFaceHtmlText(e.c));
        t =
          e.rid == Global.roleId
            ? "<span style='color:#ff0000; '> &nbsp;" +
              Global.roleName +
              "</span>："
            : "<span style='color:#E6C604;' > &nbsp;" + e.n + "</span>：";
        var i = "";
        e.h && e.h.length > 0 && (i = e.h);
        var c = "<a id='itesss' style='color:#ffffff;' >" + i + "</a> " + t;
        (this.textfield.width = Laya.stage.width - 25),
          (this.textfield.x = 10),
          (this.textfield.style.color = "#ffffff"),
          (this.textfield.style.fontSize = 14),
          (this.textfield.style.valign = "middle"),
          (this.textfield.innerHTML = c + e.c),
          (this.textfield.height = this.textfield.contextHeight + 8);
      }),
      (t.prototype.clickName = function () {}),
      (t.prototype.privateChatLineMessage = function (e) {
        var t;
        (this.textfield.width = Laya.stage.width - 130),
          (this.textfield.x = 2),
          (this.textfield.style.color = "#c0c0c0"),
          (this.textfield.style.fontSize = 12),
          (e.content = this.dealHtmlEscapeStr(e.content)),
          (e.content = this.getFaceHtmlText(e.content)),
          (t =
            "我" == e.fname
              ? "<span style='color:#ff0000; '> &nbsp;" +
                Global.roleName +
                "</span>："
              : "");
        var i = e.date,
          c = e.date.split(" ").pop().split(":");
        c.length > 1 && (i = c[0] + ":" + c[1]);
        var l =
          "<span  style='color:#ff00ff;' >" +
          i +
          "</span> " +
          t +
          "<span style='color:#A0522D;' >" +
          e.content +
          "</span> ";
        (this.textfield.innerHTML = l),
          (this.textfield.height = this.textfield.contextHeight + 8);
      }),
      (t.prototype.systemChatLineMessage = function (e) {
        var t = "";
        (this.textfield.width = Laya.stage.width - 53),
          (this.textfield.x = 2),
          (this.textfield.style.color = "#c0c0c0"),
          (this.textfield.style.fontSize = 14),
          (e.content = this.dealHtmlEscapeStr(e.content)),
          (e.content = this.getFaceHtmlText(e.content)),
          "我" == e.fname &&
            (t =
              "<span style='color:#ff0000; '> &nbsp;" +
              Global.roleName +
              "</span>：");
        var i = e.date,
          c = e.date.split(" ").pop().split(":");
        c.length > 1 && (i = c[0] + ":" + c[1]);
        var l = "";
        (-1 == e.content.indexOf("邀请您加入他的队伍") &&
          -1 == e.content.indexOf("申请加入您")) ||
          (l = "<span style='color:#e0e81b;' >同意</span>");
        var n =
          "<span style='color:#ff00ff;' >" +
          i +
          "</span>   " +
          t +
          "<span style='color:#ffffff;' >" +
          e.content +
          "</span> " +
          l;
        (this.textfield.innerHTML = n),
          (this.textfield.height = this.textfield.contextHeight + 8);
      }),
      (t.prototype.dismissChatLineView = function () {
        this.removeSelf();
      }),
      (t.prototype.getFaceHtmlText = function (e) {
        var t = "";
        return (t += e
          .replace(
            /@cd00@/g,
            "<img src='emoji/[cd0].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd01@/g,
            "<img src='emoji/[cd1].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd02@/g,
            "<img src='emoji/[cd2].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd03@/g,
            "<img src='emoji/[cd3].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd04@/g,
            "<img src='emoji/[cd4].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd05@/g,
            "<img src='emoji/[cd5].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd06@/g,
            "<img src='emoji/[cd6].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd07@/g,
            "<img src='emoji/[cd7].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd08@/g,
            "<img src='emoji/[cd8].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd09@/g,
            "<img src='emoji/[cd9].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd010@/g,
            "<img src='emoji/[cd10].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd011@/g,
            "<img src='emoji/[cd11].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd012@/g,
            "<img src='emoji/[cd12].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd013@/g,
            "<img src='emoji/[cd13].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd014@/g,
            "<img src='emoji/[cd14].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd015@/g,
            "<img src='emoji/[cd15].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd016@/g,
            "<img src='emoji/[cd16].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd017@/g,
            "<img src='emoji/[cd17].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd018@/g,
            "<img src='emoji/[cd18].png' style='width:20px; height:20px'></img>"
          )
          .replace(
            /@cd019@/g,
            "<img src='emoji/[cd19].png' style='width:20px; height:20px'></img>"
          ));
      }),
      t
    );
  })(Laya.Box);
